﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Core;
using Tanmia.Basis.Domain;
using Tanmia.NHibernate;

namespace Tanmia.Domain
{
    public class ColorDomain : BaseDomainObject<Color>
    {
        public ColorRepository ColorRep
        {
            get { return repository as ColorRepository; }
        }

        public ColorDomain()
        {
            repository = new ColorRepository();
        }

        public IList<Color> GetsByItem(Item item)
        {
            return GetsWithSelect(ColorRep.Gets(item), Color.SelectColor);
        }

        public IList<Color> GetsByCategory(ItemCategory colorCategory)
        {
            return GetsWithSelect(repository.Gets(x => x.Category == colorCategory), Color.SelectColor);
        }

        public IList<Color> GetsWithSelect()
        {
            return GetsWithSelect(repository.Gets(), Color.SelectColor);
        }

        public IList<Color> GetsByCategoryWithEasyAdd(ItemCategory colorCategory)
        {
            return GetsWithSelect(repository.Gets(x => x.Category == colorCategory), Color.EasyAdd, Color.SelectColor);
        }
    }
}
